
set -e

verbose=
while getopts "vc" arg #选项后面的冒号表示该选项需要参数
do
    case $arg in
        v)
            verbose=-v
            ;;
        ?)  #当有不认识的选项的时候arg为?
        echo "unkonw argument"
        exit 1
        ;;
    esac
done

export OPT_BUILD_DEP=0
export PACKAGE=ly.audioplayer
export APPDIR=/usr/app/$PACKAGE


config() {
    rm -rf .xmake build
    rm -rf $APPDIR/*
}

build() {
    xmake $verbose -P . $1
}

install() {
    tree build/linux
    xmake install -P .
    mkdir -p $ /usr/apphome/$PACKAGE
}


config audioplayer
ant build-jar
ant build-header
build player_jni
install